package ac2.util.serial.handlers;

import msg.AC2Messages;
import ac2.util.serial.packets.AC2Packet;
import ac2.util.serial.packets.IBytePacket;

public class PacketHandlerFactory {
	
	public static IPacketHandler Create(IBytePacket packet)
	{
		IPacketHandler handler = null;
		
		// Get the message ID from the message
		AC2Packet ac2Packet = (AC2Packet)packet;
		
		
		switch (ac2Packet.getMessageId())
		{
		case AC2Messages.FUNCTION_TEMPERATURE_UPDATE:
			handler = new TemperatureUpdatePacketHandler();
			break;
		case AC2Messages.FUNCTION_SET_TARGET_TEMPERATURE:
			// N/A for incoming messages
			break;
		case AC2Messages.FUNCTION_SET_MODE:
			// N/A for incoming messages
			break;
		case AC2Messages.FUNCTION_VENT_STATUS_UPDATE:
			handler = new VentStatusUpdatePacketHandler();
			break;
		case AC2Messages.FUNCTION_REQUEST_VENT_STATUS:
			// N/A for incoming messages
			break;
		}
	
		
		return handler;
	}
	
}
